// =============================================================================
// Mixins
// =============================================================================

// Please note that the mixins partial shouldn't include any classes. This is so
// it can be included in any file without accidentally producing output

@mixin clearfix() {
    &:before,
    &:after {
        content: ' ';
        display: table;
    }

    &:after {
        clear: both;
    }
}

@mixin unlist() {
    margin-top: 0;
    margin-bottom: 0;
    padding-left: 0;
    list-style-type: none;
    font-style: normal;

    li {
        list-style-type: none;
        font-style: normal;
    }
}

@mixin unlistimmediate() {
    /* remove list styles, but only for the immediate element - allow nested lists inside it
    to keep the default style */

    margin-top: 0;
    margin-bottom: 0;
    padding-left: 0;
    list-style-type: none;
    font-style: normal;

    > li {
        list-style-type: none;
        font-style: normal;
    }
}

@mixin transition($transition...) {
    body.ready & {
        transition: $transition;
    }
}

@mixin visuallyhidden {
    border: 0;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;

    &:active,
    &:focus {
        clip: auto;
        height: auto;
        margin: 0;
        overflow: visible;
        position: static;
        width: auto;
    }
}


@mixin visuallyvisible {
    clip: none;
    height: auto;
    width: auto;
    margin: auto;
    overflow: visible;
    position: initial;
}


@mixin icon () {
    font-family: 'wagtail';
    font-style: normal;
    font-weight: normal;
    font-variant: normal;
    text-transform: none;
    speak: none;
    text-decoration: none;
    width: 1.3em;
    line-height: 1em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-align: left;
    vertical-align: middle;
    margin-right: 0.2em;
}


@mixin webfont($fontname, $filestub, $weight, $style:normal) {
    @font-face {
        font-family: '#{$fontname}';
        src: url('#{$font-root}#{$filestub}.woff2') format('woff2'),
           url('#{$font-root}#{$filestub}.woff') format('woff'),
           url('#{$font-root}#{$filestub}.ttf') format('truetype');
        font-weight: $weight;
        font-style: $style;
    }
}
